class Node:
    def __init__(self, value):
        self._value = value
        self._ap = []



    def add_child(self, node):
        self._ap.append(node)

    def __iter__(self):
        return iter(self._ap)

    def m(self):
        yield self
        for i in self:
            yield from i.m()